/**
 * 角色数据表格
 */
Ext.namespace("Ext.ux");

Ext.ux.grid.RoleGrid = Ext.extend(Ext.ux.grid.BasicGrid, {
	initComponent: function(){
		var gridStructure = [{ 
			name: 'roleId',
			hidden: true
		},{
			name: 'roleCode',  
			header: "角色编号",
			sortable: true,
			width:25
		},{
			name: 'roleName',  
			header: "角色名称",
			sortable: true,
			width: 25
		},{
			name: 'roleType',  
			header: "角色类别",
			sortable: true,
			width: 25
		},{
			name: 'remark',  
			header: "备注",
			sortable: true,
			width: 25
		}];
		
		this.structure = gridStructure;
		this.defaultSortField = 'roleCode';
		this.keyField = 'roleId';
		
		Ext.ux.grid.RoleGrid.superclass.initComponent.call(this);
	},
	
	getRoleIds: function(){
		var _record = this.getSelectionModel().getSelections();;
		if(_record != null && _record.length > 0){
			var roleIds = new Array();
			for(var i=0; i<_record.length; i++){
				roleIds.push(_record[i].get('roleId'));
			}
			return roleIds;
		}else
			return null;
	}
});